package com.vcc.web.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.vcc.core.annotations.*;
import com.vcc.data.entity.Currency;
import com.vcc.service.client.vo.currency.CurrencyVo;
import com.vcc.service.service.CurrencyService;
import com.vcc.service.service.UserService;
import com.vcc.service.service.WalletService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.stream.Collectors;

@RestController
@RequestMapping("currency")
public class CurrencyController {

    @Autowired
    private CurrencyService currencyService;
    @Autowired
    private UserService userService;
    @Autowired
    private WalletService walletService;

    @RestPack
    @PostMapping("listAll")
    @SaCheckPermission("currency:view")
    public List<CurrencyVo> listAll() {
        List<Currency> list = currencyService.list();
        return list.stream().map(CurrencyVo::new).collect(Collectors.toList());
    }

}
